﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using System.Threading;
//using System.Windows;
using System.Web.Security;

namespace WpfApplication
{
    class SecureCalibration
    {
        public bool checkWindowsUser()
        {
            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
            WindowsIdentity identity = (WindowsIdentity)principal.Identity;
            //MessageBox.Show("Identity type: " + identity.ToString() + "\nName: " + identity.Name + "\nUsers: ");

            //return principal.IsInRole(WindowsBuiltInRole.Administrator);
            return principal.IsInRole(WindowsBuiltInRole.User);
        }

        public bool checkLogin(string name, string pw)
        {
            return Membership.ValidateUser(name, pw);
        }
    }
}
